package com.example.flshtarvel.mapper;

import com.example.flshtarvel.entity.ArticleLikeMap;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleLikeMapMapper {
    //信息点赞
    @Insert("insert into article_like_map (article_id,user_id) values(#{articleId},#{userId})")
    public int ArticleLike(String articleId, String userId);

    //取消点赞
    @Delete("delete from article_like_map where article_id=#{articleId} and user_id=#{userId}")
    public int deleteArticleLike(String articleId,String userId);

    //查询点赞    根据信息id 用户id
    @Select("select * from article_like_map where article_id=#{articleId} and user_id=#{userId}")
    public List<ArticleLikeMap> selectArticleLikeByArticleIdAndUserId(String articleId, String userId);

    //查询点赞数   根据信息id
    @Select("select count(*) from article_like_map where article_id=#{articleId}")
    public int selectArticleLikeByArticleId(String articleId);


}
